package com.eascs.ticket.ticket.controller;

import javax.inject.Inject;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.eascs.site.controller.BaseRestController;
import com.eascs.site.view.PaginationRestResult;
import com.eascs.ticket.ticket.form.TicketSearchForm;

@RestController
public class TicketSearchRestController extends BaseRestController {

	@Inject
	private TicketSearchComponent ticketSearchComponent;

	@RequestMapping("/ticket/ajax/search")
	public PaginationRestResult search(TicketSearchForm ticketSearchForm) {
		return PaginationRestResult.buildPaginationRestResult(ticketSearchComponent.search(ticketSearchForm));
	}

	@RequestMapping("/ticket/ajax/my/watcher")
	public PaginationRestResult getMyWatcher(TicketSearchForm ticketSearchForm) {
		return PaginationRestResult.buildPaginationRestResult(ticketSearchComponent.getMyWatcher(ticketSearchForm));
	}

	@RequestMapping("/ticket/ajax/my/done")
	public PaginationRestResult getMyDone(TicketSearchForm ticketSearchForm) {
		return PaginationRestResult.buildPaginationRestResult(ticketSearchComponent.getMyDone(ticketSearchForm));
	}

}
